package com.example.spindrift.service;

import com.example.spindrift.dao.SysUserMapper;
import com.example.spindrift.models.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserService {
    @Autowired
    SysUserMapper sysUserMapper;

    public List<SysUser> getAllUser(){
        return sysUserMapper.getAllUser();
    }
    public SysUser getUserById(Integer userId){
        return sysUserMapper.getUserById(userId);
    }
    public SysUser login(String account,String pwd){
        return sysUserMapper.getUserByLogin(account,pwd);
    }
    public SysUser getUserByLogin(String account,String pwd){
        return sysUserMapper.getUserByLogin(account,pwd);
    }
    public List<SysUser> searchUser(String keyword){
        return sysUserMapper.searchUser(keyword);
    }

    public List<SysUser> getUserByRoleId(String roles) {
        return sysUserMapper.getUserByRoleId(roles);
    }

    public Integer insertUser(SysUser user) {
        return sysUserMapper.insertUser(user);
    }

    public Integer deleteUser(Integer userId) {
        return sysUserMapper.deleteUser(userId);
    }
    public Integer updateUser(SysUser user) {
        return sysUserMapper.updateUser(user);
    }
    public Integer forbiddenUser(Integer userId) {
        return sysUserMapper.forbiddenUser(userId);
    }
    public Integer startUser(Integer userId) {
        return sysUserMapper.startUser(userId);
    }
    public Integer updateUserRole(String userId, String roles) {
        return sysUserMapper.updateUserRole(userId,roles);
    }
    public Integer deleteUserRole(String userId, String roles) {
        return sysUserMapper.deleteUserRole(userId,roles);
    }
    public Integer addUserRole(String userId, String roles) {
        return sysUserMapper.addUserRole(userId,roles);
    }
}
